<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>文本框</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
    <![endif]-->
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
    <![endif]-->
    <link rel="stylesheet" href="formDesign.css">
    <script type="text/javascript" src="../dialogs/internal.js"></script>
    <script type="text/javascript">
/* Thank you by
http://www.alt-tag.com/blog/2006/02/ie-dom-bugs/ */
function createElement(type, name)
{
    var element = null;
    try {
        element = document.createElement('<'+type+' name="'+name+'">');
    } catch (e) {}
    if(element==null) {
        element = document.createElement(type);
        element.name = name;
    }
    return element;
}
    </script>
</head>
<body>
<div class="content">
    <table class="table table-bordered table-striped table-hover">
     <tr>
        <th><span>控件名称</span><span class="label label-important">*</span></th>
        <th><span>默认值</span> </th>
    </tr>
    <tr>
        <td><input type="text" id="orgname" placeholder="必填项"></td>
        <td><input type="text" id="orgvalue" placeholder="无则不填"></td>
    </tr>
    <tr>
        <th><span>占位字符</span> </th>
        <th><span>对齐方式</span> </th>
    </tr>
    <tr>
        <td>
            <input type="text" id="orgtype" placeholder="无则不填"/>

        </td>
        <td>
            <select id="orgalign">
                <option value="left" >左对齐</option>
                <option value="center">居中对齐</option>
                <option value="right">右对齐</option>
            </select>
        </td>
    </tr>
    <tr>
        <th colspan="2"><span>&nbsp;&nbsp;&nbsp;&nbsp;长&nbsp;&nbsp;X&nbsp;&nbsp;宽&nbsp;&nbsp;&nbsp;&&nbsp;&nbsp;&nbsp;字体大小</span> </th>

    </tr>
    <tr>
        <td colspan="2">
            <input id="orgwidth" type="text" value="150" class="input-small span1" placeholder="auto"/>
            X
            <input id="orgheight" type="text" value="" class="input-small span1" placeholder="auto"/>
            &
            <input id="orgfontsize" type="text"  value="" class="input-small span1" placeholder="auto"/> px

        </td>

    </tr>

    </table>
</div>
<script type="text/javascript">

dialog.oncancel = function () {};
dialog.onok = function (){
    if($G('orgname').value==''){
        alert('请输入控件名称');
        return false;
    }
    var gValue=$G('orgvalue').value.replace(/\"/g,"&quot;"),
        gTitle=$G('orgname').value.replace(/\"/g,"&quot;"),
        gFontSize=$G('orgfontsize').value,
        gAlign=$G('orgalign').value,
        gWidth=$G('orgwidth').value,
        gHeight=$G('orgheight').value,
        gType=$G('orgtype').value;


        var oNode = createElement('input',gTitle);
        oNode.setAttribute('type','text');
        oNode.setAttribute('placeholder',gType);
        oNode.setAttribute('value',gValue);
        oNode.setAttribute('name',gTitle);
        if( gFontSize != '' ) {
            oNode.style.fontSize = gFontSize + 'px';
        }
        if( gAlign != '' ) {
            oNode.style.textAlign = gAlign;
        }
        if( gWidth != '' ) {
            oNode.style.width = gWidth+ 'px';
        }
        if( gHeight != '' ) {
            oNode.style.height = gHeight+ 'px';
        }
        editor.execCommand('insertHtml',oNode.outerHTML);


};
</script>
</body>
</html>
